clear
%cd ('W:\Projects\Hoffmann_Shcherbakova\Programs_RES')
format('bank');

%%Table 2 
display('     Table 2: Risk Sharing and Small Business Importance')
display('               Panel A ')
display('               mu_k=shapi ')
display('               1964-1984')
display('Low shapi')
state_group='Low_Shapi_64_75';
s=1;
T=21;

Main_preparation

M=[ones(size(dgsp)),dy(s:s+T-1,1:K)];
NL=[];


 if ~exist('estimator')
     estimator='OLS';
 end
 if ~exist('channel')
     channel='all';
 end
 
 channel='betaU';
 
Main

display('Middle shapi')
state_group='Middle_Shapi_64_75';

Main_preparation
M=[ones(size(dgsp)),dy(s:s+T-1,1:K)];
Main

display('High shapi')
state_group='High_Shapi_64_75';

Main_preparation
M=[ones(size(dgsp)),dy(s:s+T-1,1:K)];
Main

display('====================================================')
display('               1985-2005')
display('Low shapi')
state_group='Low_Shapi_64_75';
s=22;
T=42;

Main_preparation

M=[ones(size(dgsp)),dy(s:s+T-1,1:K)];

Main

display('Middle shapi')
state_group='Middle_Shapi_64_75';
s=22;
T=42;
Main_preparation
M=[ones(size(dgsp)),dy(s:s+T-1,1:K)];
Main

display('High shapi')
state_group='High_Shapi_64_75';
s=22;
T=42;
Main_preparation
M=[ones(size(dgsp)),dy(s:s+T-1,1:K)];
Main

display('====================================================')
display('====================================================')
display('   ')
display('               mu_k=SBE77 ')
display('               1964-1984')
display('Low SBE')
state_group='Low_SBE77';
s=1;
T=21;

Main_preparation

M=[ones(size(dgsp)),dy(s:s+T-1,1:K)];

Main

display('Middle SBE')
state_group='Middle_SBE77';

Main_preparation
M=[ones(size(dgsp)),dy(s:s+T-1,1:K)];
Main

display('High SBE')
state_group='High_SBE77';

Main_preparation
M=[ones(size(dgsp)),dy(s:s+T-1,1:K)];
Main

display('====================================================')
display('               1985-2005')
display('Low SBE')
state_group='Low_SBE77';
s=22;
T=42;

Main_preparation

M=[ones(size(dgsp)),dy(s:s+T-1,1:K)];

 
Main

display('Middle SBE')
state_group='Middle_SBE77';
s=22;
T=42;
Main_preparation
M=[ones(size(dgsp)),dy(s:s+T-1,1:K)];
Main

display('High SBE')
state_group='High_SBE77';
s=22;
T=42;
Main_preparation
M=[ones(size(dgsp)),dy(s:s+T-1,1:K)];
Main

display('====================================================')
display('====================================================')

display('               Panel B ')
display('               1964-1984')

state_group='all';
s=1;
T=21;
channel='all';
Main_preparation

M=[dy(s:s+T-1,1:K),(ones(T,1)*mean_mu75).*dy(s:s+T-1,1:K),ones(size(dgsp)),(ones(T,1)*mean_mu75)];
%M=[dy(s:s+T-1,1:K),(ones(T,1)*mean_mu).*dy(s:s+T-1,1:K),ones(size(dgsp)),(ones(T,1)*mean_mu)];

Main
display('   ')
display('               1985-2005')

state_group='all';
s=22;
T=42;
channel='all';
Main_preparation

M=[dy(s:s+T-1,1:K),(ones(T,1)*mean_mu75).*dy(s:s+T-1,1:K),ones(size(dgsp)),(ones(T,1)*mean_mu75)];
%M=[dy(s:s+T-1,1:K),(ones(T,1)*mean_mu).*dy(s:s+T-1,1:K),ones(size(dgsp)),(ones(T,1)*mean_mu)];


Main

